CXX = mpicxx
CXXFLAGS = -O2 -fopenmp -DUSE_OPENMP -DEIGEN_USE_LAPACKE

DIRS =\
 vec\
 op\
 solver\
 eigen\
 coo\
 csr\
 csr/generator\
 csr/precond\
 csr/amg\
 bsr\
 bsr/generator\
 bsr/precond\
 bsr/amg

SRCS = $(foreach dir, $(DIRS), $(wildcard $(dir)/*.cpp))
OBJS = $(patsubst %.cpp, %.o, $(SRCS))
INCS = $(patsubst %, -I%, $(DIRS))

NAME = libyhamg.a

all:$(OBJS)
	ar r $(NAME) $(OBJS)
	mv $(NAME) ../lib
	rm -f $(OBJS)

%.o:%.cpp
	$(CXX) $(CXXFLAGS) -c -o $@ $< $(INCS)

clean:
	rm -f ../lib/$(NAME)
